home *** CD-ROM | disk | FTP | other *** search
- /* CheckDDaemon V1.0
- Loggt die Zählerzustände beim Aufruf mit, und vergleicht sie mit den letzten Werten. Unterschiede werden
- mittels Requester angezeigt.
- */
-
- p0 ="[Anlage]"
- p1 ="[Katja ]"
- p2 ="[Chef ]"
- p3 ="[Axel ]"
- p4 ="[ISDN ]"
- Waehrung="DM"
- Log ="ram:DD_Counterliste.txt"
- FONT = XEN
- SIZE = 11
-
-
-
-
- DM =" "waehrung
- titel ="CheckDDaemon V1.0"
- nl ="0a"x
- parse arg port
- port=strip(port)
- if port="?" then call SYNT
- if port="" then port="X"
- if port<0 then port="X"
- if port>4 then port="X"
- abfrageport=port
- IF ~EXISTS("libs:rexxreqtools.library") THEN DO
- SAY "Brauche RexxReqTools.library"
- EXIT
- END
- IF ~SHOW('libraries','rexxreqtools.library') THEN DO
- CALL ADDLIB("rexxreqtools.library",0,-30)
- END
-
- options results
- if exists(Log) then call Checklog
- call makelog
- exit
-
- SCHREIBELOG:
- call open(out,log,"A")
- call writeln(out,"DDlog: "Auslese)
- call close(out)
- return
-
- AUSLESEN:
- Address "DragonDaemon"
- DD_GETCOUNTER QUIET
- if rc=1 then do
- say "Es ist ein Fehler beim Counter auslesen aufgetreten..."
- exit
- end
- Auslese=RESULT
- return
-
- MAKELOG:
- call open(out,log,"W")
- call writeln(out,"Dragon Daemon - Telefon Log Datei"nl)
- call AUSLESEN
- outgoing="DDlog: "auslese
- call writeln(out,outgoing)
- call close(out)
- return
-
- CHECKLOG:
- call open(in,log,"R")
- laenge=seek(in,0,e);position=laenge
- if laenge>100 then position=laenge-100
- call seek(in,position,b)
- buf=readch(in,100)
- pos=index(buf,"DDlog: ")
- if pos~=0 then do
- buf=substr(buf,pos)
- end
- pos=length(buf); oldbuf=substr(buf,1,pos-1)
- call close(in)
- call AUSLESEN
-
- do i=0 to 4 ;dif.i=0; end
-
- if word(newbuf,4)>=word(oldbuf,4) then dif.0=word(newbuf,4)-word(oldbuf,4)
- if word(newbuf,5)>=word(oldbuf,5) then dif.1=word(newbuf,5)-word(oldbuf,5)
- if word(newbuf,6)>=word(oldbuf,6) then dif.2=word(newbuf,6)-word(oldbuf,6)
- if word(newbuf,7)>=word(oldbuf,7) then dif.3=word(newbuf,7)-word(oldbuf,7)
- if word(newbuf,8)>=word(oldbuf,8) then dif.4=word(newbuf,8)-word(oldbuf,8)
-
-
- if abfrageport="0" then xxx=p0
- if abfrageport="1" then xxx=p1
- if abfrageport="2" then xxx=p2
- if abfrageport="3" then xxx=p3
- if abfrageport="4" then xxx=p4
-
- do i=0 to 4
- if dif.i=0 then dif.i=0.00
- dif.i=trunc(dif.i,2)
- end
- call schreibelog
-
- if abfrageport="X"then do
- call ausgabe2
- end
- if abfrageport~="X" then do
- call ausgabe1
- end
- exit
-
- AUSGABE1:
- Address "DragonDaemon"
- text="Angefallende Kosten seit dem "word(oldbuf,2)" "word(oldbuf,3)||nl||nl"Port"abfrageport" "xxx":"dif.abfrageport||dm
- CALL rtezrequest(text,'_Ende',Titel,'rtez_flags = ezreqf_centertext' 'rt_font = '||FONT||'.font/'||SIZE 'rtez_defaultresponse = 0')
- return
- AUSGABE2:
- Address "DragonDaemon"
- text="Angefallende Kosten seit dem "word(oldbuf,2)" "word(oldbuf,3)||nl||nl"Anlage "p0":"dif.0||dm||nl"Port1 "p1":"dif.1||dm||nl"Port2 "p2":"dif.2||dm||nl"Port3 "p3":"dif.3||dm||nl"Port4 "p4":"dif.4||dm
- CALL rtezrequest(text,'_Ende',Titel,'rtez_flags = ezreqf_centertext' 'rt_font = '||FONT||'.font/'||SIZE 'rtez_defaultresponse = 0')
- return
-
- SYNT:
- say "Syntax:"nl"CheckDDaemon <port>"nl||nl"<Port> (0-4) bestimmt den Port (0=Anlagen Zähler)"nl" X managed alle Ports (Default)"
- exit
-